package com.g7.figmaapi.web.api.figma.service;

import com.g7.figmaapi.common.result.WebResult;
import com.g7.figmaapi.web.api.figma.domain.FigmaApiBo;
import com.g7.figmaapi.web.api.figma.domain.dto.*;
import com.g7.figmaapi.web.api.figma.domain.entity.FigmaFile;
import com.g7.figmaapi.web.api.figma.domain.entity.FigmaFileVersion;
import com.g7.figmaapi.web.api.figma.domain.entity.FigmaUser;

/**
 * @author: taoxiangqian
 * @explain: Figma API相关接口定义
 * @since: 2023/10/25 14:13
 */
public interface FigmaApiService {
    /**
     * 用户授权接口
     * <a href="https://www.figma.com/developers/api#oauth2">...</a>
     *
     * @param figmaApiBo
     * @return com.g7.figmaapi.web.api.figma.domain.FigmaApiBo
     * @author taoxiangqian
     * @since 2023/10/26
     **/
    FigmaApiBo authorization(FigmaApiBo figmaApiBo);

    /**
     * 授权回调接口：
     * 校验state是否与授权接口生成的一致，再通过code调用获取access_token和refresh_token API
     * todo 因PKCE模式参数问题暂时不使用
     * <a href="https://www.figma.com/developers/api#oauth2">...</a>
     *
     * @param figmaCallBackBo 回调实体
     * @author taoxiangqian
     * @since 2023/10/26
     **/
    WebResult authorizationCallBack(FigmaCallBackBo figmaCallBackBo);

    /**
     * 刷新用户授权
     * <a href="https://www.figma.com/developers/api#authentication">刷新授权文档</a>
     *
     * @param figmaApiBo 请求实体
     * @return int
     * @author taoxiangqian
     * @since 2023/11/8
     **/
    int refreshAuthorization(FigmaApiBo figmaApiBo);

    /**
     * 解除用户授权(官方未提供解除授权接口，当前实现为解除系统中的授权信息)
     *
     * @param figmaApiBo figma通用请求实体
     * @return int
     * @author taoxiangqian
     * @since 2023/11/12 18:34:44
     **/
    int deauthorize(FigmaApiBo figmaApiBo);

    /**
     * 查询figma个人信息
     *
     * @param figmaApiBo 请求参数
     * @return com.g7.figmaapi.web.api.figma.domain.entity.FigmaUser
     * @author taoxiangqian
     * @since 2023/11/9
     **/
    FigmaUser selUsers(FigmaApiBo figmaApiBo);

    /**
     * 根据文件路径获取文件版本
     * <a href="https://www.figma.com/developers/api#users">...</a>
     *
     * @param figmaFileVersionBo 文件版本参数
     * @return com.g7.figmaapi.web.api.figma.domain.entity.FigmaFileVersion
     * @author taoxiangqian
     * @since 2023/11/8
     **/
    FigmaFileVersion selFileVersion(FigmaFileVersionBo figmaFileVersionBo);


    /**
     * 查询文件信息
     * <a href="https://www.figma.com/developers/api#get-files-endpoint">...</a>
     *
     * @param figmaFileBo 文件信息参数
     * @return String
     * @author taoxiangqian
     * @since 2023/11/10
     **/
    String selFile(FigmaFileBo figmaFileBo);

    /**
     * 查询文件节点信息
     * <a href="https://www.figma.com/developers/api#get-file-nodes-endpoint">...</a>
     *
     * @param figmaFileNodesBo 文件节点参数
     * @return String
     * @author taoxiangqian
     * @since 2023/11/12
     **/
    String selFileNodes(FigmaFileNodesBo figmaFileNodesBo);

    /**
     * 查询文件图片信息
     * <a href="https://www.figma.com/developers/api#get-images-endpoint">...</a>
     *
     * @param figmaImageBo
     * @return java.lang.String
     * @author taoxiangqian
     * @since 2023/11/12 17:30:44
     **/
    String selImage(FigmaImageBo figmaImageBo);

    /**
     * 查询文档中图像填充中所有图像的下载链接
     *
     * @param figmaImageFillsBo
     * @return java.lang.String
     * @author taoxiangqian
     * @since 2023/11/12 17:33:22
     **/
    String selImageFills(FigmaImageFillsBo figmaImageFillsBo);
}
